package com.owulia.leetcode.num;

public class RemoveDuplicatesForList {

    public int removeDuplicates(int[] nums) {
        if (nums.length <= 1) {
            return nums.length;
        }
        int numsTemp = nums[0];
        int i = 1;
        for (int j = 1; i < nums.length; j++) {
            if (numsTemp != nums[j]) {
                i++;
                nums[i] = nums[j];
            }
        }
        return i;
    }
}
